def practise(f,s):
    result=[]

    while f and s :
        if f[0][0]>s[0][1]:
            s.pop(0)
        elif f[0][1]<s[0][0]:
            f.pop(0)
        else:
            a=max(f[0][0],s[0][0])
            b=min(f[0][1],s[0][1])
            result.append([a,b])
            if f[0][1]<s[0][1]:
                f.pop(0)
            else:
                s.pop(0)
    return result


list1=[[0,2],[5,10],[13,23],[24,25]]
list2=[[1,5],[8,12],[15,24],[25,26]]
print(practise(list1,list2))
